﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.IO;
namespace 电影售票系统
{
    public partial class Form2 : Form
    {
        public static string a;
        public Form2()
        {
            InitializeComponent();
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void label12_Click(object sender, EventArgs e)
        {

        }

        private void label21_Click(object sender, EventArgs e)
        {

        }


        private void button1_Click(object sender, EventArgs e)
        {
            string strBinPath = GetFilePath();
            Process pr = new Process();
            pr.StartInfo.FileName = "1.txt";//文件全称-包括文件后缀
            pr.StartInfo.CreateNoWindow = true;
            pr.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            pr.StartInfo.Verb = "Print";
            pr.Start();
        }

        private void button92_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("您是否退出系统？", "结束", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                Application.Exit();
        }



        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {

        }
        private static string GetFilePath()
        {
            string filepath = AppDomain.CurrentDomain.BaseDirectory;
            int binPos = filepath.IndexOf("bin");
            string binPath = filepath.Remove(binPos);
            return binPath;
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void groupBox3_Enter(object sender, EventArgs e)
        {


        }

        private void button93_Click(object sender, EventArgs e)
        {
            string sqlStr = "server=.;database=movie;integrated security=SSPI";
            SqlConnection con = new SqlConnection(sqlStr);
            con.Open();
            string selectsql = "Select * from Table_2 where data='"+comboBox1 .Text .Trim ()+"' ";
            SqlCommand com = new SqlCommand(selectsql, con);
            com.CommandType = CommandType.Text;
            SqlDataReader sdr;
            sdr = com.ExecuteReader();
            if (sdr.Read())
            {
                string b;
                b = sdr["name"].ToString().Trim ();
                if (b == comboBox2.Text.Trim())
                {
                    textBox1.Text = sdr["price"].ToString();
                }
            }
  
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {

        }



        private void button11_Click(object sender, EventArgs e)
        {

        }



        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void checkBox6_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            
            if (checkBox1.Checked == true)
            {
                a = "第一排第一座";
            }

            if (checkBox2.Checked == true)
            {
                a = "第一排第二座";
            }
            if (checkBox3.Checked == true)
            {
                a = "第一排第三座";
            } if (checkBox4.Checked == true)
            {
                a = "第一排第四座";
            } if (checkBox5.Checked == true)
            {
                a = "第一排第五座";
            } if (checkBox6.Checked == true)
            {
                a = "第一排第六座";
            } if (checkBox7.Checked == true)
            {
                a = "第二排第一座";
            } if (checkBox8.Checked == true)
            {
                a = "第二排第二座";
            } if (checkBox9.Checked == true)
            {
                a = "第二排第三座";
            } if (checkBox10.Checked == true)
            {
                a = "第二排第四座";
            } if (checkBox11.Checked == true)
            {
                a = "第二排第五座";
            } if (checkBox12.Checked == true)
            {
                a = "第二排第六座";
            } if (checkBox13.Checked == true)
            {
                a = "第三排第六座";
            } if (checkBox14.Checked == true)
            {
                a = "第三排第五座";
            } if (checkBox15.Checked == true)
            {
                a = "第三排第四座";
            } if (checkBox16.Checked == true)
            {
                a = "第三排第三座";
            } if (checkBox17.Checked == true)
            {
                a = "第三排第二座";
            } if (checkBox18.Checked == true)
            {
                a = "第三排第一座";
            } if (checkBox19.Checked == true)
            {
                a = "第四排第六座";
            } if (checkBox20.Checked == true)
            {
                a = "第四排第五座";
            } if (checkBox21.Checked == true)
            {
                a = "第四排第四座";
            } if (checkBox22.Checked == true)
            {
                a = "第四排第三座";
            } if (checkBox23.Checked == true)
            {
                a = "第四排第二座";
            } if (checkBox24.Checked == true)
            {
                a = "第四排第一座";
            } if (checkBox25.Checked == true)
            {
                a = "第五排第六座";
            } if (checkBox26.Checked == true)
            {
                a = "第五排第五座";
            } if (checkBox27.Checked == true)
            {
                a = "第五排第四座";
            } if (checkBox28.Checked == true)
            {
                a = "第五排第三座";
            }
            if (checkBox29.Checked == true)
            {
                a = "第五排第二座";
            } if (checkBox30.Checked == true)
            {
                a = "第五排第一座";
            }
            if (checkBox31.Checked == true)
            {
                a = "第六排第六座";
            } if (checkBox32.Checked == true)
            {
                a = "第六排第五座";
            } if (checkBox33.Checked == true)
            {
                a = "第六排第四座";
            } if (checkBox34.Checked == true)
            {
                a = "第六排第三座";
            } if (checkBox35.Checked == true)
            {
                a = "第五排第二座";
            } if (checkBox36.Checked == true)
            {
                a = "第五排第一座";
            }
            foreach (Control c in groupBox3.Controls)
            {
                if (c is CheckBox && ((CheckBox)c).Checked == true)
                {
                 
                    MessageBox.Show("购票成功"+" "+a );
                }
                
            }
          
            
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void checkBox7_CheckedChanged(object sender, EventArgs e)
        {

        }
    }
}

